package com.chat.service;

import com.chat.Local;
import com.chat.common.Group;
import com.chat.common.Message;
import com.chat.common.MessageType;

/*
  设置群身份
 */
public class SetState {
    //设为管理员
    public void set(String groupid,String userid){
        Message msg=new Message();
        Group group=new Group();
        msg.setMesType(MessageType.MESSAGE_SET_ADMIN);
        group.setId(groupid);
        group.setUserid(userid);
        msg.setData(group);
        ClientConnectServerThread clientConnectServerThread=ManageClientConnectServerThread.getClientConnectServerThread(Local.user.getUsername());
        clientConnectServerThread.send(msg);
    }
    //取消管理员
    public void cancel(String groupid,String userid){
        Message msg=new Message();
        Group group=new Group();
        msg.setMesType(MessageType.MESSAGE_CANCEL_ADMIN);
        group.setId(groupid);
        group.setUserid(userid);
        msg.setData(group);
        ClientConnectServerThread clientConnectServerThread=ManageClientConnectServerThread.getClientConnectServerThread(Local.user.getUsername());
        clientConnectServerThread.send(msg);
    }
    //转让群主
    public void transfer(String groupid,String userid){
        Message msg=new Message();
        Group group=new Group();
        msg.setMesType(MessageType.MESSAGE_TRANSFER);
        group.setId(groupid);
        group.setUserid(userid);
        msg.setData(group);
        ClientConnectServerThread clientConnectServerThread=ManageClientConnectServerThread.getClientConnectServerThread(Local.user.getUsername());
        clientConnectServerThread.send(msg);
    }

}
